Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HttpProtocol enum and http_protocol field to Message #21

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

edmonds
Copy link
Member

@edmonds edmonds commented Mar 19, 2024

This commit adds a new HttpProtocol enum that represents HTTP versions and adds an optional http_protocol field to the Message message. This allows specifying the particular HTTP version used if the DOH protocol is in use.

Hypothetically, this field could be used in the future to specify the HTTP version in use for an HTTP-based DNS transport protocol that is not the currently existing RFC 8484 DOH protocol. However, at the time of this writing none of the other currently defined dnstap SocketProtocol values are HTTP-based transports, so the http_protocol field should only be set if socket_protocol is set to DOH. Otherwise, the http_protocol field should be left unset.

This commit adds a new `HttpProtocol` enum that represents HTTP versions
and adds an optional `http_protocol` field to the `Message` message.
This allows specifying the particular HTTP version used if the DOH
protocol is in use.

Hypothetically, this field could be used in the future to specify the
HTTP version in use for an HTTP-based DNS transport protocol that is not
the currently existing RFC 8484 DOH protocol. However, at the time of
this writing none of the other currently defined dnstap `SocketProtocol`
values are HTTP-based transports, so the `http_protocol` field
should only be set if `socket_protocol` is set to DOH. Otherwise, the
`http_protocol` field should be left unset.
@edmonds
Copy link
Member Author

edmonds commented Mar 19, 2024

This addresses #20.

Copy link
Contributor

@rgacogne rgacogne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me (DNSdist developer here), thanks!

@jelu
Copy link
Member

jelu commented Jan 24, 2025

I would suggest adding this as a new message for protocol metadata so that it can be extended to other protocols, existing and future ones.

Example:

message ProtocolMetadata {
  optional HttpProtocol http_protocol ...
  optional TLSVersion tls_version ...
  optional QUICVersion quic_version ...
  ...
}

message Message {
  ...
  optional ProtocolMetadata protocol_metadata = 16;
  ...
}

@edmonds
Copy link
Member Author

edmonds commented Jan 24, 2025

I would suggest adding this as a new message for protocol metadata so that it can be extended to other protocols, existing and future ones.

Example:

message ProtocolMetadata {
  optional HttpProtocol http_protocol ...
  optional TLSVersion tls_version ...
  optional QUICVersion quic_version ...
  ...
}

message Message {
  ...
  optional ProtocolMetadata protocol_metadata = 16;
  ...
}

Why? This is no more extensible than adding those fields directly to Message but adds the additional overhead of encapsulating the fields inside a submessage. E.g. for protobuf-c users this requires another alloc.

@jelu
Copy link
Member

jelu commented Jan 27, 2025

Why? This is no more extensible than adding those fields directly to Message but adds the additional overhead of encapsulating the fields inside a submessage. E.g. for protobuf-c users this requires another alloc.

It's easier to find, read, understand, document and consumers that doesn't care for protocol metadata could skip it altogether.

But sure, they can be put in Message also as, at least IMO, if you're adding metadata about one protocol you should look at adding it for all the other that the specification support. There might also be a lot more interesting information to gather then just the HTTP protocol version.

@edmonds
Copy link
Member Author

edmonds commented Jan 27, 2025

Why? This is no more extensible than adding those fields directly to Message but adds the additional overhead of encapsulating the fields inside a submessage. E.g. for protobuf-c users this requires another alloc.

It's easier to find, read, understand, document and consumers that doesn't care for protocol metadata could skip it altogether.

All of the fields in the Message message, with the exception of the actual DNS wire messages themselves (query_message, response_message) are "metadata", and some of those metadata fields (e.g. socket_family, socket_protocol, the address/port fields) are specifically "protocol" or "connection" metadata, so I would find it somewhat confusing to put some of the protocol/connection metadata in Message and some of it in a submessage. (What would be the criteria for putting some metadata in Message and some metadata in a SomethingMetadata submessage?) So I don't agree with your assertion here. The fields in the Policy message went into an optional submessage, so it does seem plausible that some things should be placed in a submessage, maybe if they are tightly related and always appear together, or something.

consumers that doesn't care for protocol metadata could skip it altogether.

Sure, but they still pay the cost of the extra framing (handful of extra bytes per payload, plus allocs, when present).

But sure, they can be put in Message also as, at least IMO, if you're adding metadata about one protocol you should look at adding it for all the other that the specification support. There might also be a lot more interesting information to gather then just the HTTP protocol version.

I agree, it would also be nice to capture TLS and QUIC versions if those protocols are in use.

@edmonds edmonds merged commit 6412261 into dnstap:main Feb 1, 2025
@edmonds edmonds deleted the message-http-protocol branch February 1, 2025 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants